# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1069.1.237 -> 1.1069.1.238
#	include/asm-ia64/mmu_context.h	1.5     -> 1.5.3.1
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 04/01/08	steiner@sgi.com	1.1069.1.238
# [PATCH] ia64: fix ia64_ctx.lock deadlock
# 
# I hit a deadlock involving the ia64_ctx.lock. The lock
# may be taken in interrupt context to process an IPI from smp_flush_tlb_mm.
# --------------------------------------------
#
diff -Nru a/include/asm-ia64/mmu_context.h b/include/asm-ia64/mmu_context.h
--- a/include/asm-ia64/mmu_context.h	Thu Jan  8 16:34:23 2004
+++ b/include/asm-ia64/mmu_context.h	Thu Jan  8 16:34:23 2004
@@ -62,12 +62,13 @@
 static inline mm_context_t
 get_mmu_context (struct mm_struct *mm)
 {
+	unsigned long flags;
 	mm_context_t context = mm->context;
 
 	if (context)
 		return context;
 
-	spin_lock(&ia64_ctx.lock);
+	spin_lock_irqsave(&ia64_ctx.lock, flags);
 	{
 		/* re-check, now that we've got the lock: */
 		context = mm->context;
@@ -77,7 +78,7 @@
 			mm->context = context = ia64_ctx.next++;
 		}
 	}
-	spin_unlock(&ia64_ctx.lock);
+	spin_unlock_irqrestore(&ia64_ctx.lock, flags);
 	return context;
 }